/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import interfaces.CandidateCapable;
import interfaces.CompanyAdquiredProfileCapable;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author damfercer
 */
@Entity
@Table(name = "company_adquired_profile_folder")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CompanyAdquiredProfileFolder.findAll", query = "SELECT c FROM CompanyAdquiredProfileFolder c"),
    @NamedQuery(name = "CompanyAdquiredProfileFolder.findByIdCompanyAdquiredProfileFolder", query = "SELECT c FROM CompanyAdquiredProfileFolder c WHERE c.idCompanyAdquiredProfileFolder = :idCompanyAdquiredProfileFolder"),
    @NamedQuery(name = "CompanyAdquiredProfileFolder.findByIdCompanyAdquiredProfileAndFolder", query = "SELECT c FROM CompanyAdquiredProfileFolder c WHERE c.companyAdquiredProfile.idCompanyAdquiredProfile = :idCompanyAdquiredProfile AND c.companyFolder.idCompanyFolder = :idCompanyFolder"),
    @NamedQuery(name = "CompanyAdquiredProfileFolder.findByCreationDate", query = "SELECT c FROM CompanyAdquiredProfileFolder c WHERE c.creationDate = :creationDate")})
public class CompanyAdquiredProfileFolder implements Serializable,CompanyAdquiredProfileCapable {
    @JoinColumn(name = "COMPANY_ADQUIRED_PROFILE_FOLDER_STATE", referencedColumnName = "ID_COMPANY_ADQUIRED_PROFILE_FOLDER_STATE")
    @ManyToOne
    private CompanyAdquiredProfileFolderState companyAdquiredProfileFolderState;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_COMPANY_ADQUIRED_PROFILE_FOLDER")
    private Integer idCompanyAdquiredProfileFolder;
    @Basic(optional = false)
    @NotNull
    @Column(name = "CREATION_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date creationDate;
    @JoinColumn(name = "COMPANY_FOLDER", referencedColumnName = "ID_COMPANY_FOLDER")
    @ManyToOne(optional = false)
    private CompanyFolder companyFolder;
    @JoinColumn(name = "COMPANY_ADQUIRED_PROFILE", referencedColumnName = "ID_COMPANY_ADQUIRED_PROFILE")
    @ManyToOne(optional = false)
    private CompanyAdquiredProfile companyAdquiredProfile;

    public CompanyAdquiredProfileFolder() {
    }

    public CompanyAdquiredProfileFolder(Integer idCompanyAdquiredProfileFolder) {
        this.idCompanyAdquiredProfileFolder = idCompanyAdquiredProfileFolder;
    }

    public CompanyAdquiredProfileFolder(Integer idCompanyAdquiredProfileFolder, Date creationDate) {
        this.idCompanyAdquiredProfileFolder = idCompanyAdquiredProfileFolder;
        this.creationDate = creationDate;
    }

    public Integer getIdCompanyAdquiredProfileFolder() {
        return idCompanyAdquiredProfileFolder;
    }

    public void setIdCompanyAdquiredProfileFolder(Integer idCompanyAdquiredProfileFolder) {
        this.idCompanyAdquiredProfileFolder = idCompanyAdquiredProfileFolder;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public CompanyFolder getCompanyFolder() {
        return companyFolder;
    }

    public void setCompanyFolder(CompanyFolder companyFolder) {
        this.companyFolder = companyFolder;
    }

    @Override
    public CompanyAdquiredProfile getCompanyAdquiredProfile() {
        return companyAdquiredProfile;
    }

    public void setCompanyAdquiredProfile(CompanyAdquiredProfile companyAdquiredProfile) {
        this.companyAdquiredProfile = companyAdquiredProfile;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCompanyAdquiredProfileFolder != null ? idCompanyAdquiredProfileFolder.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CompanyAdquiredProfileFolder)) {
            return false;
        }
        CompanyAdquiredProfileFolder other = (CompanyAdquiredProfileFolder) object;
        if ((this.idCompanyAdquiredProfileFolder == null && other.idCompanyAdquiredProfileFolder != null) || (this.idCompanyAdquiredProfileFolder != null && !this.idCompanyAdquiredProfileFolder.equals(other.idCompanyAdquiredProfileFolder))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.CompanyAdquiredProfileFolder[ idCompanyAdquiredProfileFolder=" + idCompanyAdquiredProfileFolder + " ]";
    }

    public CompanyAdquiredProfileFolderState getCompanyAdquiredProfileFolderState() {
        return companyAdquiredProfileFolderState;
    }

    public void setCompanyAdquiredProfileFolderState(CompanyAdquiredProfileFolderState companyAdquiredProfileFolderState) {
        this.companyAdquiredProfileFolderState = companyAdquiredProfileFolderState;
    }

    @Override
    public Candidate getCandidate() {
        return getCompanyAdquiredProfile().getCandidate();
    }
    
}
